package com.shiguiwu.springmybatis.spring.createbean;

/**
 * @description: 工厂方法
 * 包括实例工厂和静态工厂
 * @author: stone
 * @date: Created by 2021/3/8 17:28
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.spring.createbean
 */
public class PigFactory {

    public static Pig create() {
        System.out.println("静态工厂方法，调用无参数构造。。。。。");
        return new Pig();
    }

    public static Pig create(String name,Integer age) {
        System.out.println("静态工厂方法，调用全参数构造。。。。。");
        return new Pig(name, age);
    }

    public  Pig createByInstance () {
        System.out.println("实例工厂方法，调用无参数构造。。。。。");
        return new Pig();
    }

    public  Pig createByInstance(String name,Integer age) {
        System.out.println("实例工厂方法，调用全参数构造。。。。。");
        return new Pig(name, age);
    }
}
